package demo1225.pm;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Date;

/*
ObjectOutputStream:?????????
??????????????????????????.
?????????????????????????Serializable???,
???????serialVersionUID?????.

??????:
public ObjectOutputStream(OutputStream out)throws IOException
???????ObjectOutputStream????
???????:
public void writeObject(Object obj);
??????????????????????????.
public void flush();
???????????????????????
public void close();
??????.

 */
public class Demo_01 {
    public static void main(String[] args) {
        try (ObjectOutputStream oos = new ObjectOutputStream
                (new FileOutputStream("s.txt"))) {

            oos.writeObject(new Student("101", "tom"));

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
